param(
	[Parameter(Mandatory = $False)]
	[string]$Configuration = "Release",
	[Parameter(Mandatory = $False)]
	[string]$Version="0.0.1",
	[Parameter(Mandatory = $False)]
	[AllowEmptyString()]
	[string]$VersionSuffix = $Null
)

$OutDirectory="out/$Version"
Remove-Item $OutDirectory -Recurse -Force
New-Item -ItemType directory -Path $OutDirectory

if ($VersionSuffix -eq "")
{
	$FullVersion="$Version"
	dotnet msbuild "/t:Restore" /p:Version=$Version /p:Configuration=$Configuration
	dotnet msbuild "/t:Pack" /p:Version=$Version /p:Configuration=$Configuration
}
else
{
	$FullVersion="$Version-$VersionSuffix"
	dotnet msbuild "/t:Restore" /p:Version=$Version /p:VersionSuffix=$VersionSuffix /p:Configuration=$Configuration
	dotnet msbuild "/t:Pack" /p:Version=$Version /p:VersionSuffix=$VersionSuffix /p:Configuration=$Configuration
}

Copy-Item src\XCrawler\bin\$Configuration\XCrawler.$FullVersion.nupkg $OutDirectory
##Copy-Item test\XCrawler.Test\bin\$Configuration\XCrawler.Test.$FullVersion.nupkg $OutDirectory

